package com.ruoyi.staff.service.impl;/**
 * @Title:IStaffServiceImpl
 * @ClassName: ruoyi
 * @Description: TODO
 * @author: java
 * @time: 2024/3/1 9:32
 */

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.staff.mapper.StaffMapper;
import com.ruoyi.staff.service.IStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import com.ruoyi.staff.domain.Staff;
import java.util.List;

/**
 * @ClassName: IStaffServiceImpl
 * @Description: TODO
 * @author: java
 * @time: 2024/3/1 9:32
 */
@Service
public class StaffServiceImpl implements IStaffService {
    @Autowired
    private StaffMapper staffMapper;

    /**
     * 查询员工信息
     *
     * @param id 员工信息主键
     * @return 员工信息
     */
    @Override
    public Staff selectStaffById(Long id)
    {
        return staffMapper.selectStaffById(id);
    }

    @Override
    public Staff selectStaffByPhone(String phone)
    {
        return staffMapper.selectStaffByPhone(phone);
    }

    /**
     * 查询员工信息列表
     *
     * @param staff 员工信息
     * @return 员工信息
     */
    @Override
    public List<Staff> selectStaffList(Staff staff)
    {
        return staffMapper.selectStaffList(staff);
    }

    @Override
    public List<String> selectMasterListById(Long id) {
        return staffMapper.selectMasterListById(id);
    }

    @Override
    public List<String> selectDiscipleListById(Long id) {
        return staffMapper.selectDiscipleListById(id);
    }

    @Override
    public List<String> selectSubordinateListById(Long id) {
        return staffMapper.selectSubordinateListById(id);
    }

    /**
     * 新增员工信息
     *
     * @param staff 员工信息
     * @return 结果
     */
    @Override
    public int insertStaff(Staff staff)
    {
        staff.setCreateTime(DateUtils.getNowDate());
        return staffMapper.insertStaff(staff);
    }
    /**
     * 修改员工信息
     *
     * @param staff 员工信息
     * @return 结果
     */
    @Override
    public int updateStaff(Staff staff)
    {
        staff.setUpdateTime(DateUtils.getNowDate());
        return staffMapper.updateStaff(staff);
    }

    /**
     * 批量删除员工信息
     *
     * @param ids 需要删除的员工信息主键
     * @return 结果
     */
    @Override
    public int deleteStaffByIds(Long[] ids)
    {
        return staffMapper.deleteStaffByIds(ids);
    }


    /**
     * 批量逻辑删除员工信息
     *
     * @param ids 需要删除的员工信息主键
     * @return 结果
     */
    @Override
    public int logicDeleteStaff(Long[] ids,String delType,Long delUser)
    {
        return staffMapper.logicDeleteStaff(ids,delType,delUser);
    }

    /**
     * 删除员工信息
     *
     * @param id 员工信息主键
     * @return 结果
     */
    @Override
    public int deleteStaffById(Long id)
    {
        return staffMapper.deleteStaffById(id);
    }
}
